/* enum */
import ComponentNameEnum from '@model/enum/ComponentNameEnum'
/* entity */
import TaskAllotUserInfo from '@model/entity/TaskAllotUserInfo'
import Tag from '@model/entity/Tag/Tag'
import LoginUser from '@model/entity/LoginUser/LoginUser'
/* interface */
import { ElSelectOption } from '@src/modules/task/components/TaskAllotModal/TaskAllotExcutor/TaskAllotUserTable/TaskAllotUserTableInterface'
/* model */
import Page from '@model/Page'
import { 
  AllotSortedEnum, 
  AllotLocationEnum, 
  TaskAllotUserTableEnterpriseEditionColumns, 
  TaskAllotUserTableStandEditionColumns,
  AllotLabelEnum,
  AllotConflictEnum,
  QualificationsEnum
} from '@src/modules/task/components/TaskAllotModal/TaskAllotExcutor/TaskAllotUserTable/TaskAllotUserTableModel'
import { TaskAllotUserSearchModel } from '@model/param/in/Task'
/* props */
import TaskAllotExecutorProps from '@src/modules/task/components/TaskAllotModal/TaskAllotExcutor/TaskAllotExecutorProps'
/* types */
import Column from '@model/types/Column'
/* util */
import { isEnterpriseEdition } from '@shb-lib/version'
import { safeNewDate } from '@src/util/time';

import { chooseExUser } from '@model/config/SelectUserConfig'
import { getRootWindowInitData } from '@src/util/window'
import i18n from '@src/locales'
import { TranslateResult } from 'vue-i18n'
class TaskAllotExecutorData extends TaskAllotExecutorProps {
//   /* 客户信息 */
//   @Prop() readonly customer: Customer | undefined
//   /* 负责人信息信息 */
//   @Prop() readonly executor: LoginUser | undefined
//   /* 是否为转派 */
//   @Prop() readonly isReAllot: boolean | undefined
//   /* 是否显示协同人 */
//   @Prop() readonly isShowSynergy: boolean | undefined
//   /* 派单方式 模式(列表，地图，日历) */
//   @Prop() readonly mode: TaskAllotTypeModeEnum | undefined
//   /* 转派原因 */
//   @Prop() readonly reason: string | undefined
//   /* 工作状态颜色数组 */
//   @Prop() readonly stateColorMap: StateColorMap | undefined
//   /* 协同人列表 */
//   @Prop() readonly synergyUserList: LoginUser[] | undefined
//   /* 工单信息 */
//   @Prop() readonly task: any | undefined
//   /* 工单设置 */
//   @Prop() readonly taskConfig: TaskConfig | undefined
//   /* 工单类型列表 */
//   @Prop() readonly taskTypesMap: { [x: string]: TaskType} | undefined
//   /* 转派选择的原因 */
//   @Prop() public customReason: string = ''
//   /*异常列表 */
//   @Prop()
//   readonly backList: Array<string>  = []
//   /*判断是否配置 */ 
//   @Prop() readonly systemAdmin: any | undefined
  

  /* 备份的获取人员数据参数 */
  public backupFetchUserParams: {
    map: TaskAllotUserSearchModel | null,
    list: TaskAllotUserSearchModel | null,
    calendar: TaskAllotUserSearchModel | null
  } = {
    map: null,
    list: null,
    calendar: null
  }
  /* 客户团队信息 */
  public customerTags: Tag[] = []
  /* 表格列 */
  public columns: Column[] = (
    // 企业版 和 标准版 有所区分 (企业版支持 车程, 驾车距离)
    isEnterpriseEdition() ? TaskAllotUserTableEnterpriseEditionColumns : TaskAllotUserTableStandEditionColumns
  )
  /* 是否显示人员卡片信息 */
  public isShowUserCard: boolean = false
  /* 是否禁用加载更多 */
  public isDisableLoadmore: boolean = false
  /* 是否在正在加载中 */
  public isHaveLoading: boolean = false
  /* 已经加载的组件列表 TODO: 实现 keep-alive component 功能 */
  public loadedComponents: string[] = [ComponentNameEnum.TaskAllotUserTable]
  /* 距离 其他数据 */
  public locationOtherData: {
    minValue: number | null ,
    maxValue: number | null ,
    isChecked?: boolean
  } = { 
    minValue: 0,
    maxValue: null,
    isChecked: false
  }
  /* 冲突配置列表 */
  public conflictOptions: ElSelectOption[] = [
    { label: i18n.t('task.components.taskAllotModal.conflictType') as string, value: AllotConflictEnum.All },
    { label: i18n.t('task.components.taskAllotModal.noConflictAtAll') as string, value: AllotConflictEnum.NoConflict },
    { label: i18n.t('task.components.taskAllotModal.partsConflict') as string, value: AllotConflictEnum.PartOfConflict },
    { label: i18n.t('task.components.taskAllotModal.completeConflict') as string, value: AllotConflictEnum.CompletelyConflict }
  ]
  /* 标签配置列表 */
  public labelOptions: ElSelectOption[] = [
    { label: i18n.t('task.components.taskAllotModal.staffPicks') as string, value: AllotLabelEnum.Null },
    { label: i18n.t('task.components.taskAllotModal.manager') as string, value: AllotLabelEnum.Leader },
    { label: i18n.t('task.components.taskAllotModal.nearest') as string, value: AllotLabelEnum.DistanceSort },
    { label: i18n.t('task.components.taskAllotModal.topThreeApplauseRate') as string, value: AllotLabelEnum.DegreeTopThree },
    { label: i18n.t('task.components.taskAllotModal.allEmployees') as string, value: AllotLabelEnum.AllEmployees }
  ]
  /* 距离选项列表 */
  public locationOptions: ElSelectOption[] = [
    { label: i18n.t('task.components.taskAllotModal.distance') as string, value: AllotLocationEnum.All },
    { label: i18n.t('task.components.taskAllotModal.withinKm', {num: 5}) as string, value: AllotLocationEnum.Five },
    { label: i18n.t('task.components.taskAllotModal.withinKm', {num: 10}) as string, value: AllotLocationEnum.Ten },
    { label: i18n.t('task.components.taskAllotModal.withinKm', {num: 20}) as string, value: AllotLocationEnum.Twenty },
    { label: i18n.t('task.components.taskAllotModal.withinKm', {num: 50}) as string, value: AllotLocationEnum.Fifty },
    { label: i18n.t('common.base.other') as string, value: AllotLocationEnum.Other },
  ]
  /* 地图用户page */
  public mapUserPage: Page =  new Page()
  /* 日历用户page */
  public calendarUserPage: Page =  new Page()
  /* 等待状态 */
  public pending: boolean = false
  /* 表格排序数据 */
  public orderDetail: { order: boolean, code: number } | {} = {}
  /* 当前选择的员工标签 */
  public selectStaffTag: string[] = []
  /* 员工标签数据 */
  public staffTagList: Tag[] = []
  /* 当前选择的工作状态 */
  public selectUserState: string[] = []
  /* 当前选择的距离 */
  public selectLocation: number = AllotLocationEnum.All
  /* 当前选择的标签 */
  public selectLabel: AllotLabelEnum = AllotLabelEnum.Null
  /* 当前选择的冲突类型 */
  public selectConflict: AllotConflictEnum = AllotConflictEnum.All
  /* 选择的负责人信息 */
  public selectedExcutorUser: TaskAllotUserInfo | null = null
  /* 当前选择的排序方式 */
  public selectSortord: number | null = null
  /* 当前选择的团队 */
  public selectTeams: Tag[] = []
  /* 当前选择的团队人员列表 */
  public selectTeamUsers: LoginUser[] = []
  /* 当前选择的部门人员列表 */
  public selectDeptUsers: LoginUser[] = []
  // /* 计划开始时间 */
  public calendarStartTimeChild: string = ''
  /* 计划结束时间 */
  public calendarEndTimeChild: string = ''
  /* 冲突提示 */
  public clashTips: string | TranslateResult = ''
  /* 团队用户page */
  public teamUserPage: Page =  new Page()
  /* 表格用户page */
  public tableUserPage: Page =  new Page()
  /* 表格高度 */
  public tableHeight: number | null = null
  /* 表格排序筛选配置列表 */
  public tableSortLabelOptionss: ElSelectOption[] = [
    { label: i18n.t('task.components.taskAllotModal.distanceFirst') as string,  value: AllotSortedEnum.Distance },
    { label: i18n.t('task.components.taskAllotModal.todayOrderNumLowToHigh') as string,  value: AllotSortedEnum.AcceptTaskByTodaySearch },
    { label: i18n.t('task.components.taskAllotModal.praiseFirst') as string,  value: AllotSortedEnum.TaskDegreePercentByMonth },
  ]
  /* 用户选择状态 */
  public userPageCheckedMap: {[x: string]: boolean} = {}
  public planTimeDatePickeroptions:any = {
    disabledDate(time: any) {
      return time.getTime() < safeNewDate(safeNewDate().toLocaleDateString()).getTime()
    }
  }
  /* 资质列表 */
  public qualificationsList: { label: string, value: string }[] = [
    { label: i18n.t('task.components.taskAllotModal.taskQualification') as string, value: QualificationsEnum.TaskQualifications },
    { label: i18n.t('task.components.taskAllotModal.productMenuQualification') as string, value: QualificationsEnum.ProductQualifications },
    { label: i18n.t('task.components.taskAllotModal.areaQualification') as string, value: QualificationsEnum.AreaQualifications },
    { label: i18n.t('common.form.type.engineerQualification') as string, value: QualificationsEnum.EngineerQualification },
  ]
  /* 是否选择了授权资质 */
  public isSelectQualifications: boolean = false
  /* 选中的授权资质的值 */
  public selectQualifications: string[] = []
  /**
   * @des 协同人选人组件需要的自定义参数
   * @see https://publink.yuque.com/docs/share/14a5c525-1842-4a59-b09a-1435b8e3592b?#
   */
  public synergySelectOptions: object={
    ...chooseExUser
  }
  public excutorSelectFn:string = 'all'
  // 选人控件服务商相关控制
  public selectUserShowSp:boolean = false

  // 符合资质控制
  public allowQualificationManagement:boolean = false

}


export default TaskAllotExecutorData
